C code for PEGetNFormulas, PEGetNthFormula, and PECheckFormula

The following code provides examples of how the functions PEGetNFormulas, PEGetNthFormula, and PECheckFormula can be used:

PEGetNFormulas

short        nFormulas;
nFormulas = PEGetNFormulas(Job);
if (nFormulas < 0){
    // Handle error
}

PEGetNthFormula

short            formulaN;
    // the formula we are interested in
HANDLE    nameHandle;
short        nameLength;
char        *nameString;
HANDLE    textHandle;
short        textLength;
char        *textString; formulaN = 0;
    // Get information on the first formula in the report
if (!PEGetNthFormula(Job, formulaN, &nameHandle, &nameLength,
&textHandle, &textLength)){
    // Handle error
}
    // Allocate buffers
nameString = (char*)malloc(nameLength);
textString = (char*)malloc(textLength);
if (!PEGetHandleString(nameHandle, nameString, nameLength)){
    // Handle error
}
if (!PEGetHandleString(textHandle, textString, textLength)){
    // Handle error
}

PECheckFormula

char formulaName [] = "MyFormula";
    // Check to see if the formula text in @MyFormula is valid
if (!PECheckFormula(Job, formulaName)){
    // Formula is invalid
}


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com